﻿
namespace WFBot.Data.Repository
{
    using WFBot.Framework.Domain;
    using WFBot.Framework.Repositories;
    using System.Linq;
using System.Collections.Generic;

    public class VisitorRepository : RepositoryBase<Visitor>, IVisitorRepository
    {
        public VisitorRepository(IDatabaseFactory databaseFactory)
            : base(databaseFactory)
        {

        }

        public Visitor GetBySessionId(string sessionId)
        {
            return Database.Visitors.SingleOrDefault(v => v.SessionId == sessionId);
        }

        public IList<Visitor> FindByIdentifier(string identifier)
        {
            return Database.Visitors.Where(v => v.Identifier.Contains(identifier)).ToList();
        }
    }
}
